﻿using System;
using Autodesk.Revit.DB;
using YArchitech.Revit;
using YJKRGeometry;

namespace YJKArchMethodLibrary.Previewer
{
	public class FormCurveInfo
	{
		public bool Scaled
		{
			get
			{
				return this.m_Scaled;
			}
			set
			{
				this.m_Scaled = value;
			}
		}

		public Curve CurveObj
		{
			get
			{
				return this.m_Curve;
			}
			set
			{
				this.m_Curve = value;
			}
		}

		public PenColor Color
		{
			get
			{
				return this.m_Color;
			}
			set
			{
				this.m_Color = value;
			}
		}

		public float LineWidth
		{
			get
			{
				return this.m_LineWidth;
			}
			set
			{
				this.m_LineWidth = value;
			}
		}

		public FormCurveInfo(FormCurveInfo rhs)
		{
			this.m_Scaled = rhs.Scaled;
			this.m_Curve = rhs.CurveObj;
			this.m_Color = rhs.Color;
			this.m_LineWidth = rhs.m_LineWidth;
		}

		public FormCurveInfo(Curve curve, PenColor color, float lineWidth, bool scaled)
		{
			this.m_Curve = curve;
			this.m_Color = color;
			this.m_LineWidth = lineWidth;
			this.m_Scaled = scaled;
		}

		public XYZ MidPoint()
		{
			XYZ result = this.m_Curve.GetEndPoint(0);
			if (this.m_Curve.GetType() == typeof(Line))
			{
				result = Geometry.CalculatMidPoint(this.m_Curve as Line);
			}
			else if (this.m_Curve.GetType() == typeof(Arc))
			{
				result = Geometry.CalculatMidPoint(this.m_Curve as Arc);
			}
			return result;
		}

		private bool m_Scaled;

		private Curve m_Curve;

		private PenColor m_Color;

		private float m_LineWidth;
	}
}
